import requests
# 在json文件 标头headers里面找到异步加载数据的url
url='https://xueqiu.com/statuses/hot/listV2.json?since_id=-1&max_id=-1&size=15'


headers = {
    'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',
    'Referer':  #print resp不是200就加host referer cookie。。。。。。
        'https://xueqiu.com/today',
    'Host':
        'xueqiu.com',
    'Cookie':
        'cookiesu=411702135406858; device_id=091be70a999046ed738a40f59212b92b; Hm_lvt_1db88642e346389874251b5a1eded6e3=1702135404; remember=1; xq_a_token=571597c3d7e4a67e06ea42d2c89e1faf98718a17; xqat=571597c3d7e4a67e06ea42d2c89e1faf98718a17; xq_id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1aWQiOjUxMzQyOTY1NzMsImlzcyI6InVjIiwiZXhwIjoxNzA0NzI5MzAzLCJjdG0iOjE3MDIxMzczMDM3MTEsImNpZCI6ImQ5ZDBuNEFadXAifQ.BAUMFVnQJwDHpV2EkArpvqPc4zw7A00xu49cxx26s2keMTelg9Oe5O887zL6XoEQAUWk0BQ9vwDieXr0r0B4uTpuDA2SFn0pwupeiKdWgF7pMjCu7IXxuH0YYCl82l8VHUiDTtamjnVDWffcZdopsHCIvEAUfc5OFHsAajM0gsrJMLyefwyKRyOSy8MTj7uxUX7FKsCKUeYLr8zqJTvqk4sMwtG2g52XCIet2ZMS1khpN05_XX9H53iKptAASI0iKTpeY0Z2kJjU3pci53gAWICrX_49DBbJ8j0hxUYJLVt8KQX8TFvEaHHAQEF6ylCJvojEJmj4BCx77tG_P8PYUg; xq_r_token=54fbd3223479efbf5ce521cf6641af3eade879b7; xq_is_login=1; u=5134296573; s=bi1c1lgwl1; bid=01f64f3f4d67d30f8c227b23e3c522a2_lpy8m9ac; Hm_lpvt_1db88642e346389874251b5a1eded6e3=1702137408'
}

resp = requests.get(url,headers=headers)
print(resp)  # 不断增加headers的内容直到访问成功
print(resp.json())  # 得到json数据
